package com.zhw;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.util.PoiPublicUtil;
import com.zhw.entity.ProjectSrcDetailExcelDTO;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;

import java.io.File;
import java.util.Date;
import java.util.List;

/**
 * @auther weizhang52 on 2018/11/21
 * @description
 * @modify
 */
public class ProjectSrcDetailExcelDTOtest {

    public static void main(String[] args) {
        ImportParams params = new ImportParams();
        //设置标题
        params.setTitleRows(1);
        //设置表头
        params.setHeadRows(1);
        params.setNeedVerfiy(true);
        System.out.println("params.getHeadRows():"+params.getHeadRows());
        System.out.println("params.getStartRows():"+params.getStartRows());
        System.out.println("params.getTitleRows():"+params.getTitleRows());
        System.out.println("params.getReadRows():"+params.getReadRows());
        long start = new Date().getTime();
        List<ProjectSrcDetailExcelDTO> list = ExcelImportUtil.importExcel(
                new File("D:\\easypoi\\ExcelExportMsgClient.xlsx"),
                ProjectSrcDetailExcelDTO.class, params);
        System.out.println(new Date().getTime() - start);
        System.out.println("大小:"+list.size());
        System.out.println("全部数据:"+list);
        System.out.println("数据:"+ReflectionToStringBuilder.toString(list.get(0)));

    }

}
